#include<iostream>
#include<vector>
#include<queue>
#include<cstring>
#include<cmath>
#include<map>
#include<set>
#include<cstdio>
#include<algorithm>
#define debug(a) cout<<#a<<"="<<a<<endl;
using namespace std;
const int maxn=5e3+100;
typedef long long LL;
inline LL read(){LL x=0,f=1;char ch=getchar();	while (!isdigit(ch)){if (ch=='-') f=-1;ch=getchar();}while (isdigit(ch)){x=x*10+ch-48;ch=getchar();}
return x*f;}
struct P{
    LL w,h,id;
}a[maxn];
bool cmp(P A,P B){
    if(A.w==B.w) return A.h<B.h;
    return A.w<B.w;
}
LL dp[maxn],pre[maxn];
int main(void)
{
  cin.tie(0);std::ios::sync_with_stdio(false);
  LL n,w,h;cin>>n>>w>>h;
  for(LL i=1;i<=n;i++){
    cin>>a[i].w>>a[i].h;a[i].id=i;
  }
  sort(a+1,a+1+n,cmp);
  for(LL i=1;i<=n;i++){
    if(a[i].w>w&&a[i].h>h) dp[i]=1;
  }
  for(LL i=1;i<=n;i++){
    for(LL j=1;j<i;j++){
        if(a[i].w<=w||a[i].h<=h) continue;
        if(a[j].h<a[i].h&&a[j].w<a[i].w){
            if(dp[i]<dp[j]+1){
                dp[i]=dp[j]+1;
                pre[i]=j;
            }
        }
    }
  }
  /*
  for(LL i=1;i<=n;i++){
    cout<<dp[i]<<" ";
  }
  cout<<"\n";
  for(LL i=1;i<=n;i++){
    cout<<a[i].w<<" "<<a[i].h<<"\n";
  }*/
  LL ans=0;LL pos=0;
  for(LL i=1;i<=n;i++){
    if(ans<dp[i]){
        ans=dp[i];
        pos=i;
    }
  }
  cout<<ans<<"\n";
  if(ans==0) return 0;
  vector<LL>v;
  v.push_back(pos);
  while(pre[pos]!=0) v.push_back(pre[pos]),pos=pre[pos];
  reverse(v.begin(),v.end());
  for(auto i:v){
    cout<<a[i].id<<" ";
  }
  cout<<"\n";
return 0;
}
